/*
 ------------------------------------------------------------------------------
 Copyright (C) 2013 Eternal Games.

 This file is part of the GLQuake source code.

 The GLQuake source code is free software; you can redistribute it and/or
 modify it under the terms of the GNU General Public License as published by
 the Free Software Foundation; either version 2 of the License, or (at your
 option) any later version.

 The GLQuake source code is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
 or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
 more details.

 You should have received a copy of the GNU General Public License along with
 the GLQuake source code; if not, write to the Free Software Foundation, Inc.,
 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 ------------------------------------------------------------------------------
*/


//
// sg_info.cpp - generic information entities
//


#include "sg_local.h"


/*
 ==============================================================================

 INFO_INTERMISSION

 ==============================================================================
*/


/*
 ==================
 
 ==================
*/
void SG_InfoIntermission_Spawn (etEntity *self){

}


/*
 ==============================================================================

 INFO_NOTNULL

 ==============================================================================
*/


/*
 ==================
 SG_InfoNotNULL_Spawn
 ==================
*/
void SG_InfoNotNULL_Spawn (etEntity *self){

}


/*
 ==============================================================================

 INFO_NULL

 ==============================================================================
*/


/*
 ==================
 SG_InfoNULL_Spawn
 ==================
*/
void SG_InfoNULL_Spawn (etEntity *self){

	// Remove ourselves
	SG_FreeEntity(self);
}


/*
 ==============================================================================

 INFO_PLAYER_COOP

 ==============================================================================
*/


/*
 ==================
 SG_InfoPlayerCoop_Spawn
 ==================
*/
void SG_InfoPlayerCoop_Spawn (etEntity *self){

	if (level.mode != GM_COOP)
		return;

	if (level.numSpawnPoints == MAX_SPAWN_POINTS){
		G_Printf(S_COLOR_RED "Too many spawn points\n");

		SG_FreeEntity(self);

		return;
	}

	// Add the spawn point
	level.spawnPoints[level.numSpawnPoints].origin = self->currentOrigin;
	level.spawnPoints[level.numSpawnPoints].angles = glqAngles(0.0f, self->currentAngles.yaw, 0.0f);

	level.numSpawnPoints++;

	// Remove ourselves
	SG_FreeEntity(self);
}


/*
 ==============================================================================

 INFO_PLAYER_DEATHMATCH

 ==============================================================================
*/


/*
 ==================
 SG_InfoPlayerDeathmatch_Spawn
 ==================
*/
void SG_InfoPlayerDeathmatch_Spawn (etEntity *self){

	if (level.mode != GM_DEATHMATCH)
		return;

	if (level.numSpawnPoints == MAX_SPAWN_POINTS){
		G_Printf(S_COLOR_RED "Too many spawn points\n");

		SG_FreeEntity(self);

		return;
	}

	// Add the spawn point
	level.spawnPoints[level.numSpawnPoints].origin = self->currentOrigin;
	level.spawnPoints[level.numSpawnPoints].angles = glqAngles(0.0f, self->currentAngles.yaw, 0.0f);

	level.numSpawnPoints++;

	// Remove ourselves
	SG_FreeEntity(self);
}


/*
 ==============================================================================

 INFO_PLAYER_START

 ==============================================================================
*/


/*
 ==================
 SG_InfoPlayerStart_Spawn
 ==================
*/
void SG_InfoPlayerStart_Spawn (etEntity *self){

	if (level.mode != GM_SINGLEPLAYER)
		return;

	if (level.numSpawnPoints == MAX_SPAWN_POINTS){
		G_Printf(S_COLOR_RED "Too many spawn points\n");

		SG_FreeEntity(self);

		return;
	}

	// Add the spawn point
	level.spawnPoints[level.numSpawnPoints].origin = self->currentOrigin;
	level.spawnPoints[level.numSpawnPoints].angles = glqAngles(0.0f, self->currentAngles.yaw, 0.0f);

	level.numSpawnPoints++;

	// Remove ourselves
	SG_FreeEntity(self);
}


/*
 ==============================================================================

 INFO_PLAYER_START2

 ==============================================================================
*/


/*
 ==================
 
 NOTE: not sure what this is used for but it seems to be used when the player
 has all the runes and is on the last boss?
 ==================
*/
void SG_InfoPlayerStart2_Spawn (etEntity *self){

}


/*
 ==============================================================================

 INFO_TELEPORT_DESTINATION

 ==============================================================================
*/


/*
 ==================
 
 ==================
*/
void SG_InfoTeleportDestination_Spawn (etEntity *self){

}